package com.huawei.secure.android.common.webview;

import android.util.Log;
import android.webkit.WebView;
import com.huawei.secure.android.common.util.a;
import com.huawei.secure.android.common.util.b;
import java.util.concurrent.CountDownLatch;

public class SafeGetUrl {
    private static final String TAG = "SafeGetUrl";
    private static final long w = 200;
    private String x;
    private WebView y;

    public SafeGetUrl(WebView webView) {
        this.y = webView;
    }

    public String getUrlMethod() {
        if (this.y == null) {
            return "";
        }
        if (a.a()) {
            return this.y.getUrl();
        }
        final CountDownLatch countDownLatch = new CountDownLatch(1);
        b.a(new Runnable(this) {
            final /* synthetic */ SafeGetUrl A;

            public void run() {
                this.A.setUrl(this.A.y.getUrl());
                countDownLatch.countDown();
            }
        });
        try {
            countDownLatch.await();
        } catch (Throwable e) {
            Log.e(TAG, "getUrlMethod: InterruptedException " + e.getMessage(), e);
        }
        return this.x;
    }

    public void setWebView(WebView webView) {
        this.y = webView;
    }

    public WebView getWebView() {
        return this.y;
    }

    public void setUrl(String str) {
        this.x = str;
    }
}
